<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <h3>{{msg}}</h3>
      <h3>{{msg2}}</h3>
      <button @click="clickHandler">点我呀</button>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          msg: '别浪，猥琐发育！',
          msg2: '还是吃得太饱'
        },
        methods: {
          clickHandler () {
            this.msg = this.msg + '....'
            this.msg2 = this.msg2 + '....'

            // debugger  //这里dom还没有更新
            console.log('有改变吗')
            // setTimeout(()=>{
            //     // 批量更新dom
            // },0)
            this.$nextTick(()=>{
                //以上批次的data数据变更后，对应的dom更新在这里
            })
          }
        }
      })
    </script>
  </body>
</html>
